/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucsur.tp.colegio.form;

import edu.ucsur.tp.colegio.beans.DistritoBean;
import edu.ucsur.tp.colegio.beans.ProvinciaBean;
import edu.ucsur.tp.colegio.beans.RegionBean;
import edu.ucsur.tp.colegio.beans.SedeBean;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrador
 */
public class Windows_Sede extends javax.swing.JInternalFrame {

    /**
     * Creates new form Windows_Sede
     */
    public Windows_Sede() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        txtcodigoSede = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtnombreSede = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtdireccionSede = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txttipotelefono = new javax.swing.JTextField();
        cboTipoTelefonoSede = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        txtnroFax = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        cboprovincia = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        cboregión = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        cbodistrito = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        txtemail = new javax.swing.JTextField();
        btnNuevoSede = new javax.swing.JButton();
        btnGuardarSede = new javax.swing.JButton();
        btnModificarSede = new javax.swing.JButton();
        btneliminarSede = new javax.swing.JButton();
        btnSalirSede = new javax.swing.JButton();

        setBackground(new java.awt.Color(0, 204, 204));
        setTitle("REGISTRAR NUEVAS SEDES");

        jPanel2.setBackground(new java.awt.Color(0, 204, 204));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Ingresar Datos de la Nueva Sede"));

        jLabel1.setText("Código :");

        jLabel2.setText("Nombre :");

        jLabel3.setText("Dirección :");

        jLabel5.setText("Nro. Teléfono : ");

        cboTipoTelefonoSede.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Fijo", "Móvil", " ", " " }));

        jLabel6.setText("Nro. Fax : ");

        jLabel7.setText("Provincia :");

        cboprovincia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tumbes", "Piura", "Lambayeque", "La Libertad", "Cajarmarca", "San Martín", "Amazonas", "Loreto", "Ancash", "Lima", "Provincia Constitucional del Callao", "Húanuco", "Huancavelica", "Ica", "Pasco", "Junin", "Ucayali", "Ayacucho", "Apurimác", "Arequipa", "Moquegua", "Tacna", "Cusco", "Puno", "Madre de Dios", " ", " " }));

        jLabel8.setText("Región :");

        cboregión.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Bagua", "Bongará", "Chachapoyas", "Luya", "Rodríguez de Mendoza", "Utcubamba", "Aija", "Antonio Raimondi", "Asunción", "Bolognesi", "Carhuaz", "Casma", "Huaraz", "Huaylas", "Abancay", "Andahuaylas", "Grau", "Arequipa", "Camaná", "Castilla", "Caylloma", "Cajamarca", "Celendín", "Chota", "Jaén", "Callao", "Acomayo", "Anta", "Canchis", "Ica", "Nazca", "Palpa", "Pisco", "Chiclayo", "Trujillo", "Virú", "Lima", "Barranca", "Cajatambo", "Cañete", "Huaral", "\t", " ", " ", " ", " " }));

        jLabel9.setText("Distrito :");

        cbodistrito.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Aramango", "La Peca", "Chisquilla", "Jazan", "Huancas", "Leimebamba", "Tingo", "Yupan", "Huanchay", "Jangas", "Carmen Alto", "Tambillo", "Santillana", "Cochabamba", "Paccha", "Chilete", "Tantarica", "Socota", "Chancay", "Ichocán", "Ancahuasi", "Rondocan", "Pueblo Nuevo", "El Carmen", "Chincha Baja", "Chavín", "Chilca", "Ancón", "Ate", "Barranco", "Breña", "Carabayllo", "Chorrillos", "Cieneguilla", "Jesús María", "Comas", "La Molina", "Lince", "Miraflores", "Bellavista", "Carmen de la Legua Reynoso", "La Punta", "Ventanilla", "La Perla", " " }));

        jLabel10.setText("Email :");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel3)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(txtdireccionSede))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel2)
                                        .addComponent(jLabel1))
                                    .addGap(18, 18, 18)
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(txtcodigoSede, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(txtnombreSede, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel5)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cboTipoTelefonoSede, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(txttipotelefono)))
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel9)
                                    .addGap(18, 18, 18)
                                    .addComponent(cbodistrito, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel8)
                                    .addGap(18, 18, 18)
                                    .addComponent(cboregión, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel7)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(cboprovincia, 0, 1, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel6)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(txtnroFax, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtemail)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtcodigoSede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtnombreSede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtdireccionSede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txttipotelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cboTipoTelefonoSede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(txtnroFax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(cboprovincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(cboregión, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(cbodistrito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(txtemail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnNuevoSede.setText("NUEVO");
        btnNuevoSede.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnNuevoSede.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnNuevoSede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoSedeActionPerformed(evt);
            }
        });

        btnGuardarSede.setText("GUARDAR");
        btnGuardarSede.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnGuardarSede.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnGuardarSede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarSedeActionPerformed(evt);
            }
        });

        btnModificarSede.setText("MODIFICAR");
        btnModificarSede.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnModificarSede.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnModificarSede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarSedeActionPerformed(evt);
            }
        });

        btneliminarSede.setText("IMPRIMIR");
        btneliminarSede.setActionCommand("ELIMINAR");
        btneliminarSede.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btneliminarSede.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btneliminarSede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btneliminarSedeActionPerformed(evt);
            }
        });

        btnSalirSede.setText("SALIR");
        btnSalirSede.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSalirSede.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnSalirSede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirSedeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnNuevoSede, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(btnModificarSede, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnGuardarSede, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btneliminarSede, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnSalirSede, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(btnNuevoSede, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnGuardarSede, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnModificarSede, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btneliminarSede, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnSalirSede, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnNuevoSedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoSedeActionPerformed

    }//GEN-LAST:event_btnNuevoSedeActionPerformed

    private void btnGuardarSedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarSedeActionPerformed

        try{
            //--** Instanciando una clase del Servicio Sede (JavaBean)
            
            SedeBean sede = new SedeBean();
            
            sede.setcodigosede(txtcodigoSede.getText());
            sede.setnombreSede(txtnombreSede.getText());
            sede.setDireccion(txtdireccionSede.getText());
            sede.setTelefono(txttipotelefono.getText());
            sede.setFax(txtnroFax.getText());
            sede.setProvincia(new ProvinciaBean((String) cboprovincia.getSelectedItem(), ""));
            sede.setRegion(new RegionBean((String) cboregión.getSelectedItem(), ""));
            sede.setDistrito(new DistritoBean((String) cbodistrito.getSelectedItem(), ""));
            sede.setEmail(txtemail.getText());
            
            
        }catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(null, "Se Grabo Correctamente El Mantenimiento Sede ");
    }
        
    }//GEN-LAST:event_btnGuardarSedeActionPerformed

    private void btnModificarSedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarSedeActionPerformed

    }//GEN-LAST:event_btnModificarSedeActionPerformed

    private void btneliminarSedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarSedeActionPerformed

    }//GEN-LAST:event_btneliminarSedeActionPerformed

    private void btnSalirSedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirSedeActionPerformed
this.dispose();
    }//GEN-LAST:event_btnSalirSedeActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGuardarSede;
    private javax.swing.JButton btnModificarSede;
    private javax.swing.JButton btnNuevoSede;
    private javax.swing.JButton btnSalirSede;
    private javax.swing.JButton btneliminarSede;
    private javax.swing.JComboBox cboTipoTelefonoSede;
    private javax.swing.JComboBox cbodistrito;
    private javax.swing.JComboBox cboprovincia;
    private javax.swing.JComboBox cboregión;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField txtcodigoSede;
    private javax.swing.JTextField txtdireccionSede;
    private javax.swing.JTextField txtemail;
    private javax.swing.JTextField txtnombreSede;
    private javax.swing.JTextField txtnroFax;
    private javax.swing.JTextField txttipotelefono;
    // End of variables declaration//GEN-END:variables
}
